#include<iostream>
#include<unistd.h>
#include<sys/types.h>
#include<wait.h>
using namespace std;
int main()
{
    cout<<"I am father,my pid :" << getpid()<<endl;
    pid_t id = fork();
    if(id == 0)
    {//子进程
        int cnt = 5;
        while(cnt--)
        {
            sleep(1);        
            cout<<"我是子进程，my pid:"<<getpid()<<"    "<<"myppid:"<<getppid()<<endl;
        }
    }
    else
    {//父进程
        
        cout<<"我是父进程,my pid:"<<getpid()<<"    "<<"myppid:"<<getppid()<<endl;
        sleep(7);
        int status = 0;
        pid_t rid = wait(&status);

    }

    return 0;
}
//#include<iostream>
//#include<unistd.h>
//using namespace std;
//int main()
//{
//    cout<<"I am father,my pid :" << getpid()<<endl;
//
//
//    return 0;
//}
//#include<iostream>
//#include<unistd.h>
//using namespace std;
//int main()
//{
//    cout<<"I am father,my pid :" << getpid()<<endl;
//
//
//    return 0;
//}
//#include<iostream>
//#include<iostream>
//#include<unistd.h>
//using namespace std;
//int main()
//{
//    cout<<"I am father,my pid :" << getpid()<<endl;
//
//
//    return 0;
//}
//#include<unistd.h>
//using namespace std;
//int main()
//{
//    cout<<"I am father,my pid :" << getpid()<<endl;
//
//
//    return 0;
//}
//#include<iostream>
//#include<unistd.h>
//using namespace std;
//int main()
//{
//    cout<<"I am father,my pid :" << getpid()<<endl;
//
//
//    return 0;
//}
//#include<iostream>
//#include<unistd.h>
//using namespace std;
//int main()
//{
//    cout<<"I am father,my pid :" << getpid()<<endl;
//
//
//    return 0;
//}
//#include<iostream>
//#include<unistd.h>
//using namespace std;
//int main()
//{
//    cout<<"I am father,my pid :" << getpid()<<endl;
//
//
//    return 0;
//}
//#include<iostream>
//#include<unistd.h>
//using namespace std;
//int main()
//{
//    cout<<"I am father,my pid :" << getpid()<<endl;
//
//
//    return 0;
//}
//#include<iostream>
//#include<unistd.h>
//using namespace std;
//int main()
//{
//    cout<<"I am father,my pid :" << getpid()<<endl;
//
//
//    return 0;
//}
//#include<iostream>
//#include<unistd.h>
//using namespace std;
//int main()
//{
//    cout<<"I am father,my pid :" << getpid()<<endl;
//
//
//    return 0;
//}
//#include<iostream>
//#include<unistd.h>
//using namespace std;
//int main()
//{
//    cout<<"I am father,my pid :" << getpid()<<endl;
//
//
//    return 0;
//}
//#include<iostream>
//#include<unistd.h>
//using namespace std;
//int main()
//{
//    cout<<"I am father,my pid :" << getpid()<<endl;
//
//
//    return 0;
//}
//#include<iostream>
//#include<unistd.h>
//using namespace std;
//int main()
//{
//    cout<<"I am father,my pid :" << getpid()<<endl;
//
//
//    return 0;
//}
//#include<iostream>
//#include<unistd.h>
//using namespace std;
//int main()
//{
//    cout<<"I am father,my pid :" << getpid()<<endl;
//
//
//    return 0;
//}
//#include<iostream>
//#include<unistd.h>
//using namespace std;
//int main()
//{
//    cout<<"I am father,my pid :" << getpid()<<endl;
//
//
//    return 0;
//}
